using Identity.Application.Contracts.Common;
using Identity.Application.Permissions.Interfaces;
using Identity.Application.Permissions.Queries;
using MediatR;

namespace Identity.Application.Permissions.QueryHandlers;

public class GetBoundPermissionsForApiQueryHandler : IRequestHandler<GetBoundPermissionsForApiQuery, Result>
{
    private readonly IPermissionsReadService _permissionsReadService;

    public GetBoundPermissionsForApiQueryHandler(IPermissionsReadService permissionsReadService)
    {
        _permissionsReadService = permissionsReadService;
    }
    public async Task<Result> Handle(GetBoundPermissionsForApiQuery request, CancellationToken cancellationToken)
    {
        var boundPers = await _permissionsReadService.GetBoundPermissionsForApiAsync();
        

        return Result.Success(boundPers);
    }
}